<?
//        if($errorMsg) echo "<b><br><div class=errormsg>$errorMsg</div><br></b><br>";
//        $errorMsg = "";

        if($errorMsg) {
 	      include ('errorMsg.html');       	                
        }
        if($okMsg) {
        include ('okMsg.html');
        }
				else {
        }
?> 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td><font class="text"><b>View Clients</b></font></td>
  </tr>
</table>
<br>
<TABLE border=0 class='bTable' cellspacing='0' width='100%'>
<?
        $data = list_reseller_clients($id);
 	if(is_array($data)){
                       echo "<TR align="center">
                               <TH>Date</TH>
                               <TH>Client</TH>
                               <TH>Sale type</TH>
                               <TH>Info</TH>
                               <TH>Status</TH>
                               <TH>Price</TH>
                             </TR>
                       ";
                foreach($data as $d){
                        $buff = explode(" ",$d[date]);
                        $d[date] = $buff[0];
			if($d[client_email]) $d[client] = "<a href='mailto:$d[client_email]'>$d[client]</a>";
                        echo "<TR>
                                <TD> $d[date]</TD>
                                <TD> $d[client]</TD>
                                <TD> $d[type]</TD>
                                <TD>&nbsp; $d[sale_data]</TD>
                                <TD> $d[state]</TD>
                                <TD> $d[price]</TD>
                              </TR>
                        ";
                }
        }
        else{
                echo "<TR><TD>Empty list.</TD></TR>";
        }
?>
</TABLE>
